From 293e54c10b82ce6819272015e1225a34a554dce0 Mon Sep 17 00:00:00 2001 From: "emellor@leeni.uk.xensource.com" Date: Fri, 9 Dec 2005 10:40:41 +0000 Subject: [PATCH] Two domUs, ping from one to the other Signed-off-by: Jim Dykman --- .../tests/network/11_network_domU_ping_pos.py | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 tools/xm-test/tests/network/11_network_domU_ping_pos.py diff --git a/tools/xm-test/tests/network/11_network_domU_ping_pos.py b/tools/xm-test/tests/network/11_network_domU_ping_pos.py new file mode 100644 index 0000000000..ca3fe35793 --- /dev/null +++ b/tools/xm-test/tests/network/11_network_domU_ping_pos.py @@ -0,0 +1,79 @@ +#!/usr/bin/python + +# Copyright (C) International Business Machines Corp., 2005 +# Author: + +# Ping tests to domU interface +# - creates two guest domains +# - sets up a single NIC on each on same subnet +# - conducts ping tests to the domU IP address. + +# ping -c 1 -s $size $domU_IP +# where $size = 1, 48, 64, 512, 1440, 1500, 1505, +# 4096, 4192, 32767, 65507, 65508 + +pingsizes = [ 1, 48, 64, 512, 1440, 1500, 1505, 4096, 4192, + 32767, 65507 ] + + + +from XmTestLib import * + + +def netDomain(ip): + dom = XmTestDomain(extraOpts={ 'nics' : 1 }) + try: + dom.configSetVar('vif', " [ 'ip=" + ip + "' ]") + dom.start() + except DomainError, e: + if verbose: + print "Failed to create test domain because:" + print e.extra + FAIL(str(e)) + try: + # Attach a console + console = XmConsole(dom.getName(), historySaveCmds=True) + # Activate the console + console.sendInput("bhs") + except ConsoleError, e: + FAIL(str(e)) + return console + +rc = 0 + +Net = XmNetwork() + +try: + # pick an IP address + ip1 = Net.ip("dom1", "eth2") + mask1 = Net.mask("dom1", "eth2") +except NetworkError, e: + FAIL(str(e)) + +try: + # pick another IP address + ip2 = Net.ip("dom2", "eth2") + mask2 = Net.mask("dom2", "eth2") +except NetworkError, e: + FAIL(str(e)) + +# Fire up a pair of guest domains w/1 nic each +pinger_console = netDomain(ip1) +victim_console = netDomain(ip2) + +try: + pinger_console.runCmd("ifconfig eth0 inet "+ip1+" netmask "+mask1+" up") + victim_console.runCmd("ifconfig eth0 inet "+ip2+" netmask "+mask2+" up") + + # Ping the victim over eth0 + fails="" + for size in pingsizes: + out = pinger_console.runCmd("ping -q -c 1 -s " + str(size) + " " + ip2) + if out["return"]: + fails += " " + str(size) +except ConsoleError, e: + FAIL(str(e)) + +if len(fails): + FAIL("Ping failed for size" + fails + ".") + -- 2.30.2